﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace CrashSimul8or
{
    class Camera
    {
        Vector2 position;
        float speed;

        int MapWidthPixels;
        int MapHeightPixels;
        int ScreenWidth;
        int ScreenHeight;

        public Camera()
        {
            this.position = new Vector2();
            this.speed = 6.0f;
        }

        public void Update(int MapWidth, int MapHeight, int ScreenW, int ScreenH)
        {
            this.MapWidthPixels = MapWidth;
            this.MapHeightPixels = MapHeight;
            this.ScreenWidth = ScreenW;
            this.ScreenHeight = ScreenH;
        }

        public float Speed
        {
            get { return speed; }
            set
            {
                speed = MathHelper.Clamp(value, 0.5f, 50f);
            }
        }

        public Vector2 Position
        {
            get { return position; }

            set
            {
                position.X = MathHelper.Clamp(value.X, 0, MapWidthPixels - ScreenWidth);
                position.Y = MathHelper.Clamp(value.Y, 0, MapHeightPixels - ScreenHeight);
            }
        }
    }
}
